import Vue from 'vue'
import Vuex from 'vuex'
import { getStorage, setStorage, removeStorage } from '@/utils/storage.js'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: getStorage('hmtt_user')
  },
  mutations: {
    initUser (state, payload) {
      state.user = payload
      setStorage('hmtt_user', payload)
    },
    delUser (state) {
      state.user = null
      removeStorage('hmtt_user')
    }
  },
  actions: {},
  modules: {}
})
